package com.itheima.day24;

import javax.xml.transform.Source;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;

public class MapDemo01 {
    public static void main(String[] args) {

        //Map的基础操作

        Map<String,String> m=new HashMap<>();

        m.put("guojing1","huangrong1");
        m.put("guojing2","huangrong2");
        m.put("guojing3","huangrong3");
        System.out.println(m);//{guojing3=huangrong3, guojing2=huangrong2, guojing1=huangrong1}
//
//        boolean remove = m.remove("guojing1", "huangrong1");
//        System.out.println(remove);//true
//
//        String guojing2 = m.remove("guojing2");
//        System.out.println(guojing2);//huangrong2
//        System.out.println(m);
//
//
//        m.clear();
//        System.out.println(m);

        //判断是否包含键或者键值
        boolean guojing1 = m.containsKey("guojing1");
        System.out.println(guojing1);//true
        boolean huangrong2 = m.containsValue("huangrong5");
        System.out.println(huangrong2);//false

        int size = m.size();
        System.out.println(size);//3

        System.out.println(m);//{guojing3=huangrong3, guojing2=huangrong2, guojing1=huangrong1}





    }
}
